﻿var window_width, window_height, $body, fixed_width;

Array.prototype.remove = function (from, to) {
	this.splice(from, !to || 1 + to - from + (!(to < 0 ^ from >= 0) && (to < 0 || -1) * this.length));
	return this.length;
};
String.prototype.toSentenceCase = function () {
	return this.substring(0, 1).toUpperCase() + this.substring(1);
};

String.prototype.format = function () {

	if (arguments.length == 0)
		return this;
	var params, str = this;
	if (arguments.length > 1) {
		params = $.makeArray(arguments);
	} else {
		params = [arguments];
	}
	$.each(params, function (i, n) {
			str = str.replace(new RegExp("\\{" + i + "\\}", "g"), n);
	});

	return str;
};

$(window).ready(function () {
	$body = $(document.body);
	if (!($.browser.msie && $.browser.version < 7)) {
		setContentWidth();
		if (!fixed_width) $(window).resize(setContentWidth);
	}
});

function setContentWidth() {

	// determine width of viewport, and resize upon window resize

	window_width = $(window).width();
	window_height = $(window).height();

}
